const express = require('express');
const cors = require('cors');

// 导入路由模块
const router = require('./apiRouter');

const app = express();

// 配置解析表单参数的中间件
app.use(express.urlencoded({ extended: false }));

// cors解决跨域
app.use(cors());
app.use('/api', router)

router.get('/aaa', (req,res) => {
  const {query} = req;
  res.send({
    status: 0, // 0表示成功 1表示失败
    msg: 'ok',
    data: query
  });
})

app.listen(80, () => {
  console.log('Server listening on port 8');
});